from django.shortcuts import render
from .serial import DepartmentSerializer,HomeDoctorSerializer
from .models import Department,DoctorModel
from rest_framework.views import APIView
from rest_framework.generics import ListAPIView
from rest_framework.response import Response
# Create your views here.


class DepartmentListView(ListAPIView):
    queryset = Department.objects.all().order_by('id')
    serializer_class = DepartmentSerializer


class HomeDoctorListView(ListAPIView):
    serializer_class = HomeDoctorSerializer

    def get_queryset(self):
        data = self.kwargs.get('name')
        print(data)
        return DoctorModel.objects.filter(department__name=data).order_by('id')[0:4]



